package com.itbaizhan.shopping_goods_service.servieImpl;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itbaizhan.shopping_common.pojo.SeckillGoods;
import com.itbaizhan.shopping_common.service.SeckillGoodsService;
import com.itbaizhan.shopping_goods_service.mapper.SeckillGoodsMapper;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

/**
 * @program: shopping
 * @ClassName SeckillGoodsServiceImpl
 * @description:
 * @author: jing
 * @create: 2025-07-17 14:37
 **/

@DubboService
@Transactional
public class SeckillGoodsServiceImpl implements SeckillGoodsService {
    @Autowired
    private SeckillGoodsMapper seckillGoodsMapper;

    @Override
    public void add(SeckillGoods seckillGoods) {
        seckillGoodsMapper.insert(seckillGoods);
    }

    @Override
    public void update(SeckillGoods seckillGoods) {
        seckillGoodsMapper.updateById(seckillGoods);
    }

    @Override
    public Page<SeckillGoods> search(int page, int size) {
        Page<SeckillGoods> seckillGoodsPage = seckillGoodsMapper.selectPage(new Page<>(page, size), null);
        return seckillGoodsPage;
    }
}
